﻿CREATE PROCEDURE [dbo].[UPD_User]
	@UserName VARCHAR(50),
	@PassWord VARCHAR(50),
	@UserId AS INT

AS
/* SET NOCOUNT ON */
IF @UserName IS NULL OR @UserName = ''
BEGIN

UPDATE Users
SET
	[Password] = @PassWord
WHERE
	[UserId] = @UserId
END

ELSE IF @PassWord IS NULL OR @PassWord = ''

BEGIN

UPDATE Users
SET
	[Name] = @UserName
WHERE
	[UserId] = @UserId
	
END	
ELSE
BEGIN

UPDATE Users
SET
	[Name] = @UserName, [Password] = @PassWord
WHERE
	[UserId] = @UserId
	
END